package com.yunban.project.message.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yunban.project.message.domain.TrialApplicationRecord;
import com.yunban.project.message.dto.TrialApplicationReq;
import com.yunban.project.message.mapper.TrialApplicationRecordMapper;
import com.yunban.project.message.service.SmsService;
import com.yunban.project.message.service.TrialApplicationRecordService;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * @author: lijiajun
 * @date: 2025-03-07
 * @version: 1.0
 */
@Service
public class TrialApplicationRecordServiceImpl extends ServiceImpl<TrialApplicationRecordMapper, TrialApplicationRecord> implements TrialApplicationRecordService {
    @Resource
    private SmsService smsService;
    @Override
    public Boolean postTrialApplication(TrialApplicationReq req) {
        // 校验验证码
        this.smsService.checkCode(req.getPhoneNo(), req.getCode());
        // save
        TrialApplicationRecord r = new TrialApplicationRecord();
        BeanUtils.copyProperties(req, r);
        return this.save(r);
    }
}
